# This code is hosted on http://code.google.com/p/lenthorp/
# Freely available for use in applications, but should NOT be modified
# Email all comments to lenthorpresearch@gmail.com

import ftquote
from MySQLSaving import insertData
from datetime import datetime

def getAndSaveData(ticker, dateStart, dateEnd):
    data = ftquote.get_historical_prices(ticker, dateStart, dateEnd)
    dates = []
    rates = []
    for idx in range(len(data)):
        dates.append(data[idx][0])
        rates.append(data[idx][1])
    insertData.InsertSQLDateRate(dates, rates, 'historicalDly', ticker)